/**
 * Created by Administrator on 2017/7/12.
 */

import React,{
    Component,
} from 'react';

import {
    Text,
    StyleSheet
} from 'react-native';


export default class StateTest extends Component{

    constructor(props){
        super(props);

        this.state = {
            showText:true,
            color:'red'
        };

        setInterval(()=>{
            this.setState({
                showText: !this.state.showText,
                color:"#"+(Math.random()+"").substring(10,16)
            })
        },500);

    }

    render(){
        let text = this.state.showText ? this.props.text : '' ;
        return <Text style={{color:this.state.color}}>{text}</Text>
    }

}

const st = StyleSheet.create({
    randomColor: {
        color : "red"
    }
});